/*
 * Copyright (C) 2012 haru Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.harusource.di.delegate.impl;

import java.lang.reflect.Method;

import android.view.View;
import android.widget.TimePicker;
import android.widget.TimePicker.OnTimeChangedListener;

import com.harusource.di.delegate.Delegate;

/**
 * This class implements TimePicker.OnTimeChangedListener.</br>
 * It handles following events of TimePicker.</br>
 * </br>
 * <code>
 * void onTimeChanged(TimePicker view, int hourOfDay, int minute)
 * </code>
 * </br>
 * </br>
 * @see android.widget.TimePicker.OnTimeChangedListener#onTimeChanged(TimePicker, int, int)
 * 
 * @author Hiroki Oizumi
 */
public class TimePickerOnTimeChanged extends Delegate implements OnTimeChangedListener {

    @Override
    public void add(Method template, Object target, Method eventhandle, View view) {
        super.add(template, target, eventhandle, view);
        ((TimePicker) view).setOnTimeChangedListener(this);
    }

    @EventHandler
    public void onTimeChanged(TimePicker view, int hourOfDay, int minute) {
        invoke3(EVENTHANDLE_DEFAULT, view, hourOfDay, minute);
    }
}
